import service from "../utils/request";

export const asyncMenu = () => {
  return service({
    url: "/menu/get_menus",
    method: "get",
  });
};

// @Summary 获取menu列表
// @Produce  application/json
// @Param {
//  page     int
//	pageSize int
// }
// @Router /menu/getMenuList [post]
export const getMenuList = (data) => {
  return service({
    url: "/menu/getMenuList",
    method: "post",
    data,
  });
};

// @Summary 新增基础menu
// @Produce  application/json
// @Param menu Object
// @Router /menu/getMenuList [post]
export const addBaseMenu = (data) => {
  return service({
    url: "/menu/addBaseMenu",
    method: "post",
    data,
  });
};

// @Summary 获取基础路由列表
// @Produce  application/json
// @Param 可以什么都不填 调一下即可
// @Router /menu/get_menus [get]
export const getBaseMenuTree = () => {
  return service({
    url: "/menu/getBaseMenuTree",
    method: "get",
  });
};

// @Summary 添加角色menu关联关系
// @Produce  application/json
// @Param menus Object authorityId string
// @Router /menu/getMenuList [post]
export const addMenuAuthority = (data) => {
  return service({
    url: "/menu/add_menu_authority",
    method: "post",
    data,
  });
};

// @Summary 获取用户menu关联关系
// @Produce  application/json
// @Param authorityId string
// @Router /menu/getMenuAuthority [get]
export const getMenuAuthority = (aid) => {
  return service({
    url: `/menu/${aid}/getMenuByAuthID`,
    method: "get",
  });
};

// @Summary 修改menu列表
// @Produce  application/json
// @Param menu Object
// @Router /menu/updateBaseMenu [post]
export const updateBaseMenu = (data) => {
  return service({
    url: "/menu/updateBaseMenu",
    method: "post",
    data,
  });
};
